/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package files;

import java.util.Comparator;

class PersonComparator implements Comparator<Person>
{
    boolean cs;
    PersonComparator(boolean cs)
    {
        this.cs = cs;
    }
    
    @Override
    public int compare(Person t1, Person t2) {
        int diff;
        if (cs)
            diff = t1.first.compareTo(t2.first);
        else
            diff = t1.first.compareToIgnoreCase(t2.first);    
        if ( diff != 0)
            return diff;
        if (cs)
            return t1.last.compareTo(t2.last);
        else
            return t1.last.compareToIgnoreCase(t2.last);
    }    
}

class Person implements Comparable<Person>
{
    Person(String f, String l)
    {
        first = f;
        last = l;
    }
    String first, last;

    @Override
    public int compareTo(Person that) {
        int diff = this.last.compareTo(that.last);
        if ( diff != 0)
            return diff;
        return this.first.compareTo(that.first);
    } 
    
    @Override
    public String toString()
    {
        return last + "," + first;    
    }
    
}
public class NewClass {
    
}
